import {operationType as OT} from './enum'

const getOkText = operationType => {
    const map = {
      [OT.ADD]: '保存',
      [OT.UPDATE]: '保存',
      [OT.VIEW]: '关闭',
      [OT.STOP]: '停用',
      [OT.USE]: '启用',
    }
    return map[operationType] ? map[operationType] : ''
}

const getModalTitle = (operationType, name) => {
  const map = {
    [OT.ADD]: `新增${name}`,
    [OT.UPDATE]: `编辑${name}`,
    [OT.VIEW]: `${name}详情`,
    [OT.STOP]: `${name}停用`,
    [OT.USE]: `${name}启用`,
  }
  return map[operationType] ? map[operationType] : ''
}

export {
  getOkText,
  getModalTitle
}
